package com.neu.config;

import com.neu.entity.Project;
import com.neu.entity.Tenant;
import com.neu.entity.User;
import com.neu.service.ProjectService;
import com.neu.service.TenantService;
import com.neu.service.UserService;
import com.neu.utils.excel.DataListener;
import com.neu.utils.excel.processor.ProjectDataProcessor;
import com.neu.utils.excel.processor.TenantDataProcessor;
import com.neu.utils.excel.processor.UserDataProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DataListenerFactory {

    @Autowired
    private UserService userService;

    @Autowired
    private UserDataProcessor userDataProcessor;

    @Autowired
    private ProjectService projectService;

    @Autowired
    private ProjectDataProcessor projectDataProcessor;

    @Autowired
    private TenantService tenantService;
    @Autowired
    private TenantDataProcessor tenantDataProcessor;


    public DataListener<User> createUserListener() {
        return new DataListener<>(userService, userDataProcessor);
    }

    public DataListener<Project> createProjectListener() {
        return new DataListener<>(projectService, projectDataProcessor);
    }

    public DataListener<Tenant> createTenantListener() {
        return new DataListener<>(tenantService, tenantDataProcessor);
    }


}